<?php
use think\facade\Route;


//// 配置跨域
Route::allowCrossDomain([
    // 设置跨域允许的header头信息 , 增加token字段
    'Access-Control-Allow-Headers'     => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With, authKey, Accept, Origin, token, Access-Token',
    // 允许所有请求
    'Access-Control-Allow-Origin'      => '*',
]);


//// 登录
// localhost:8080/admin/login
//Route::post('login', 'app\admin\controller\AdminController@login')
//    ->allowCrossDomain();
Route::post('/login', 'app\admin\controller\AdminController@login');
// 令牌检测
Route::post('/check-token', 'app\admin\controller\AdminController@checkToken');
// 登出
Route::post('/logout', 'app\admin\controller\AdminController@logout');
// 信息
Route::get('/info', 'app\admin\controller\AdminController@info');


//// 系统设置-菜单节点
// 菜单添加
Route::post('/menu/add', 'app\admin\controller\MenuController@add');
// 菜单编辑
Route::post('/menu/edit', 'app\admin\controller\MenuController@edit');
// 菜单列表
Route::get('/menu/list-page', 'app\admin\controller\MenuController@menuListPage');
// 菜单树形结构
Route::get('/menu/nav-tree', 'app\admin\controller\MenuController@navTree');
// 菜单
Route::get('/navigation', 'app\admin\controller\MenuController@adminNav');


//// 角色模块
// 添加
Route::post('/role/add', 'app\admin\controller\RoleController@add');
// 编辑
Route::post('/role/edit', 'app\admin\controller\RoleController@edit');
// 分页列表
Route::post('/role/list-page', 'app\admin\controller\RoleController@listPage');
// 有效角色
Route::post('/role/valid-roles', 'app\admin\controller\RoleController@validRoles');
// 角色节点
Route::post('/role/nodes', 'app\admin\controller\RoleController@roleNodes');


//// 管理人员
// 分页列表
Route::post('/list-page', 'app\admin\controller\AdminController@listPage');
//// 注册
Route::post('/register', 'app\admin\controller\AdminController@register');
//// 更新
Route::post('/edit', 'app\admin\controller\AdminController@edit');


//// 个人设置
// 处理头像
Route::post('/avatar', 'app\admin\controller\AdminController@handleAvatar');
// 个人设置
Route::post('/basic-setting', 'app\admin\controller\AdminController@basicSetting');
// 修改密码
Route::post('/change-pass', 'app\admin\controller\AdminController@changePass');


//// Think-Queue 任务队列
Route::get('/job/push', 'app\admin\controller\JobController@push');
Route::get('/job/later', 'app\admin\controller\JobController@later');